<template>
  <div>
    <ind-header id="index-header-style" :class="{ playover }" />
    <index-audio @playover="isOver" />
    <IndexPic />
    <ind-header id="index-body-style" v-show="top > 860" />
    <indexPicture />
    <ind-footer />
  </div>
</template>

<script>
import IndexServer from "@/components/IndexServer.vue";

import IndHeader from "../components/IndHeader.vue";
// 视频
import IndexAudio from "../components/IndexAudio.vue";
// 轮播图
import IndexPic from "../components/IndexPic.vue";
// 动图
import IndexPicture from "../components/IndexPicture.vue";
// 尾页
import IndFooter from "../components/IndFooter.vue";

export default {
  components: {
    IndHeader,
    IndexAudio,
    IndexServer,
    IndFooter,
    IndexPic,
    IndexPicture,
  },
  data() {
    return {
      activeIndex: "1",
      activeIndex2: "1",
      playover: false,
      top: 100,
      t: null,
    };
  },
  mounted() {
    window.scrollTo(0, 100);
    window.addEventListener("scroll", () => {
      clearTimeout(this.t);
      this.t = setTimeout(() => {
        this.top =
          document.documentElement.scrollTop || document.body.scrollTop;
      }, 100);
    });
  },
  methods: {
    handleSelect(key, keyPath) {
      console.log(key, keyPath);
    },
    isOver(paused) {
      this.playover = paused;
    },
  },
};
</script>

<style lang="scss" scoped>
#index-header-style {
  width: calc(100vw - 17px);
  opacity: 0.3;
  transition: all 0.2s;
  position: absolute;
  z-index: 999;
}
#index-header-style.playover,
#index-header-style:hover {
  opacity: 1;
}
#index-body-style {
  width: calc(100vw - 17px);
  position: fixed;
  top: 0;
  z-index: 999;
}
</style>
